package com.yuanda.wordhot.entity;

import java.util.Date;
import java.util.List;

import org.springframework.format.annotation.DateTimeFormat;

import com.fasterxml.jackson.annotation.JsonIgnore;
import com.yuanda.wordhot.util.GlobalConstants;

/**
 * 
 * @author YuBai
 * @since 2013-3-18
 * @Description 配置类 提供系统功能配置
 * @version 1.0
 */
public class ConfigEntity implements IEntity{

	/**
	 * 
	 */
	private static final long serialVersionUID = 2027953585841161347L;
	
	private String configId; // 配置ID

	private String type; // 类型，以英文标记，便于程序引用

	private String name; // 配置名称

	private String parentId; // 父配置ID

	//private ConfigEntity parent; // 同上

	private List<ConfigEntity> children; // 取子编码

	private int order;// 排序

	private boolean valid;// 是否有效

	private boolean leaf; // 冗余，提高树的显示速度

	@DateTimeFormat(pattern = GlobalConstants.DateFormatKeys.DATE_10_FORMAT)
	private Date createTime;

	private String remark;

	private int rwFlag; // 0: 不允许修改 1：允许增加 2：允许增加和修改 3：允许增加、修改和删除

	private String extString1;

	private String extString2;

	private String extString3;

	private String extString4;

	private String extString5;

	private String extString6;

	private String state;;// 为easyui tree增加的字段

	public String getConfigId() {
		return configId;
	}

	public void setConfigId(String configId) {
		this.configId = configId;
	}

	public String getType() {
		return type;
	}

	public void setType(String type) {
		this.type = type;
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public String getParentId() {
		return parentId;
	}

	public void setParentId(String parentId) {
		this.parentId = parentId;
	}

//	@JsonIgnore
//	public ConfigEntity getParent() {
//		return parent;
//	}
//
//	@JsonIgnore
//	public void setParent(ConfigEntity parent) {
//		this.parent = parent;
//	}

	@JsonIgnore
	public List<ConfigEntity> getChildren() {
		return children;
	}

	@JsonIgnore
	public void setChildren(List<ConfigEntity> children) {
		this.children = children;
	}

	public int getOrder() {
		return order;
	}

	public void setOrder(int order) {
		this.order = order;
	}

	public boolean isValid() {
		return valid;
	}

	public void setValid(boolean valid) {
		this.valid = valid;
	}

	public boolean isLeaf() {
		return leaf;
	}

	public void setLeaf(boolean leaf) {
		this.leaf = leaf;
	}

	public Date getCreateTime() {
		return createTime;
	}

	public void setCreateTime(Date createTime) {
		this.createTime = createTime;
	}

	public String getRemark() {
		return remark;
	}

	public void setRemark(String remark) {
		this.remark = remark;
	}

	public int getRwFlag() {
		return rwFlag;
	}

	public void setRwFlag(int rwFlag) {
		this.rwFlag = rwFlag;
	}

	public String getExtString1() {
		return extString1;
	}

	public void setExtString1(String extString1) {
		this.extString1 = extString1;
	}

	public String getExtString2() {
		return extString2;
	}

	public void setExtString2(String extString2) {
		this.extString2 = extString2;
	}

	public String getExtString3() {
		return extString3;
	}

	public void setExtString3(String extString3) {
		this.extString3 = extString3;
	}

	public String getExtString4() {
		return extString4;
	}

	public void setExtString4(String extString4) {
		this.extString4 = extString4;
	}

	public String getExtString5() {
		return extString5;
	}

	public void setExtString5(String extString5) {
		this.extString5 = extString5;
	}

	public String getExtString6() {
		return extString6;
	}

	public void setExtString6(String extString6) {
		this.extString6 = extString6;
	}

	public String getState() {
		return leaf ? "open" : "closed";
	}

	public void setState(String state) {
		this.state = state;
	}

}
